<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="../js/vue.js"></script>
<body>
    <div class="app">
        <h3 v-on:click="change">{{flag?'今晚下棋':'今晚早点睡'}}</h3>
        <button v-on:click="change">切换</button>

        <h4 v-on:click="count++">{{count}}</h4>
        <p><button v-on:click="add">增加5</button><button v-on:click="reduce">减少5</button></p>
    </div>
</body>
<script>
    const vm = new Vue({
        el:".app",
        count:1,
        data:{
            flag:true,
            count:2020
        },
        methods: {
            change() {
                this.flag = !this.flag
            },
            add() {
                this.count+=5;
            },
            reduce() {
                this.count-=5;
            }
        }
    })
</script>
</html>